package com.example.base.sdk;

import com.alibaba.fastjson.JSONObject;
import com.example.base.app.AppCall;

import java.util.HashMap;
import java.util.Map;

public class SDK {

    private static String appName="system";

    /**
     * 获取用户信息通过 userName
     * @param userName 用户名
     * @return
     */
    public static JSONObject getSysUserByUserName(String userName){
        Map<String,Object> map=new HashMap<>();
        map.put("username",userName);
        return (JSONObject) AppCall.call(SDK.appName,"getSysUserByUserName",map);
    }

    /**
     * 获取部门信息通过 deptId
     * @param deptId 部门id
     * @return
     */
    public static JSONObject getSysDeptByDeptId(String deptId){
        Map<String,Object> map=new HashMap<>();
        map.put("deptId",deptId);
        return (JSONObject) AppCall.call(SDK.appName,"getSysDeptByDeptId",map);
    }

    /**
     * 获取角色信息 roleId
     * @param roleId 角色id
     * @return
     */
    public static JSONObject getSysRoleByRoleId(String roleId){
        Map<String,Object> map=new HashMap<>();
        map.put("roleId",roleId);
        return (JSONObject) AppCall.call(SDK.appName,"getSysRoleByRoleId",map);
    }

    /**
     * 获取角色信息 roleNo
     * @param roleNo 角色编号
     * @return
     */
    public static JSONObject getSysRoleByRoleNo(String roleNo){
        Map<String,Object> map=new HashMap<>();
        map.put("roleNo",roleNo);
        return (JSONObject) AppCall.call(SDK.appName,"getSysRoleByRoleNo",map);
    }

    public static JSONObject appOpenUserLogin(String userName,String appName){
        Map<String,Object> map=new HashMap<>();
        map.put("userName",userName);
        map.put("appName",appName);
        return (JSONObject) AppCall.call(SDK.appName,"appOpenUserLogin",map);
    }

}
